package davidtps.godutch.database.sqlitedal;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import davidtps.godutch.database.base.SQLiteDALbase;
import davidtps.godutch.database.base.SQLiteDBHelper.OnCreateTableListener;

public class SQliteDALCreateConsumeView implements OnCreateTableListener {

	private Context mContext;
	
	public SQliteDALCreateConsumeView(Context pContext) {
		mContext = pContext;
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		StringBuilder _Builder = new StringBuilder();
		_Builder.append("create view v_consume as select a.*,b.categoryParentId,b.CategoryState,b.categoryname,b.Path,b.TypeFlag,");
		_Builder.append("c.accountName from consumes a LEFT JOIN categorys b ON a.categoryID = b.categoryID ");
		_Builder.append("LEFT JOIN accounts c ON a.ACCOUNTID = c.accountId");
		
		db.execSQL(_Builder.toString());

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

	}


}
